precision mediump float;
varying vec2 vTextureCoord;
uniform sampler2D uTexture;
uniform sampler2D uTexture1;
uniform sampler2D uTexture2;
const mediump vec3 luminanceWeighting = vec3(0.2125, 0.7154, 0.0721);
void main(){
     float strength = 0.5;
     vec4 textureColor = texture2D(uTexture,vTextureCoord);
     mediump float blueColor = textureColor.b * 63.0;
     mediump vec2 quad1;
     quad1.y = floor(blueColor/8.0);
     quad1.x = floor(blueColor) - quad1.y*8.0;
     mediump vec2 quad2;
     quad2.y = floor(ceil(blueColor)/7.999);
     quad2.x = ceil(blueColor) - quad2.y * 8.0;
     highp vec2 texPos1;
     texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);
     texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);
     highp vec2 texPos2;
     texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);
     texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);
     lowp vec4 newColor1 = texture2D(uTexture1, texPos1);
     lowp vec4 newColor2 = texture2D(uTexture1, texPos2);
     lowp vec4 newColor = mix(newColor1, newColor2, fract(blueColor));
     vec4 origin = mix(textureColor, vec4(newColor.rgb, textureColor.w), strength);
     lowp float luminance = dot(origin.rgb, luminanceWeighting);
     lowp vec3 greyScaleColor = vec3(luminance);
     gl_FragColor = vec4(mix(greyScaleColor, origin.rgb, 3.0), origin.w);
}